package com.qd.panda.mq;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

/**
 * @author sjk
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class HkMsgProducer {
    private final StreamBridge streamBridgeTemplate;

    public boolean sender(String playLoad) {
        Message<String> message = MessageBuilder.withPayload(playLoad).build();
        boolean send = streamBridgeTemplate.send("sendHttp-out-0", message);
        log.info("进入消息队列，内容： {},发送状态: {}", playLoad,send);
        return send;
    }
}
